package com.kgc.scd.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kgc.scd.bean.Address;
import com.kgc.scd.mapper.AddressMapper;
import com.kgc.scd.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * @author: WangKuoKuo
 * @create: 2022-06-10 09:07
 * @description:
 **/
@Service
public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address>
        implements AddressService {

    @Autowired(required = false)
    private AddressMapper addressMapper;
    @Override
    public boolean insertAddr(Address address) {
        System.out.println(address);
        int insert = addressMapper.insert(address);
        return insert >0;
    }

    @Override
    public boolean updateAddr(Address address) {
        UpdateWrapper<Address> w = new UpdateWrapper<>();
        w.eq("addr_id",address.getAddrId());
        return addressMapper.update(address,w) > 0;
    }
}
